<template>
  <div :id="chatKey"></div>
</template>

<script setup>
import * as echarts from 'echarts';
import 'echarts-gl';

const props = defineProps({
  option: {type: Object},
  chatKey: {type: String},
})

const myChart = ref()
onMounted(() => {
  // 基于准备好的dom，初始化echarts实例
  const dom = document.getElementById(props.chatKey)
  myChart.value = echarts.init(dom);

  // 绘制图表
  myChart.value.setOption(props.option);
})


defineExpose({myChart})
</script>

<style scoped lang="scss">

.erha_chart {
  width: 100%;
  height: 100%;
}

</style>
